﻿using Learun.Util;
using SqlSugar;
using System;
using System.Collections.Generic;

namespace Learun.Application.TwoDevelopment.ZZDT_EC
{
    /// <summary>
    /// 版 本 PIT-ADMS V7.0.3 敏捷开发框架
    /// Copyright (c) 2013-2018 Hexagon PPM
    /// 创 建：超级管理员
    /// 日 期：2022-06-01 15:08
    /// 描 述：数据字典
    /// </summary>
    [SugarTable(TableName = "ec_dataitemdetail")]
    public class ec_dataitemdetailEntity
    {
        #region 实体成员
        /// <summary>
        /// 字典明细ID
        /// </summary>
        [SugarColumn(IsPrimaryKey = true)]
        public string DataItemDetailID { get; set; }
        /// <summary>
        /// 字典分类ID（存的是<see cref="ec_dataitemEntity.DataItemID"/>
        /// </summary>
        public string DataItemID { get; set; } = "";
        /// <summary>
        /// 上级字典明细ID。<see cref="DataItemDetailID"/>
        /// </summary>
        public string UpDataItemDetailID { get; set; } = "";
        /// <summary>
        /// 字典明细名称
        /// </summary>
        public string DataItemName { get; set; } = "";
        /// <summary>
        /// 字典明细名称（英文）
        /// </summary>
        public string DataItemNameEN { get; set; } = "";
        /// <summary>
        /// 字典明细编号
        /// </summary>
        public string DataItemCode { get; set; } = "";
        /// <summary>
        /// 排序
        /// </summary>
        public int? OrderID { get; set; }
        /// <summary>
        /// 是否有效
        /// </summary>
        public int? IsEnabled { get; set; }
        /// <summary>
        /// 备注
        /// </summary>
        public string Remark { get; set; } = "";
        /// <summary>
        /// 创建人
        /// </summary>
        public string CreateUserID { get; set; }
        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime? CreateTime { get; set; }
        /// <summary>
        /// 更新人
        /// </summary>
        public string UpdateUserID { get; set; }
        /// <summary>
        /// 更新时间
        /// </summary>
        public DateTime? UpdateTime { get; set; }
        #endregion

        #region 扩展操作
        /// <summary>
        /// 新增调用
        /// </summary>
        public void Create()
        {
            this.DataItemDetailID = Guid.NewGuid().ToString();
            this.CreateTime = Time.MySqlTime;
            UserInfo userInfo = LoginUserInfo.Get();
            this.CreateUserID = userInfo.userId;
        }
        /// <summary>
        /// 编辑调用
        /// </summary>
        /// <param name="keyValue"></param>
        public void Modify(string keyValue)
        {
            this.DataItemDetailID = keyValue;
            this.UpdateTime = Time.MySqlTime;
            UserInfo userInfo = LoginUserInfo.Get();
            this.UpdateUserID = userInfo.userId;
        }
        #endregion
        #region 扩展字段
        /// <summary>
        /// 字典编号<see cref="ec_dataitemEntity.DataItemCode"/>。如Be_signal_group
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public string ItemCode { get; set; } = "";
        /// <summary>
        /// 信号
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public List<ec_Wire_GroupEntity> Signals { get; set; }
        #endregion
    }
}

